home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 34.zip
/
BS1 part 34
/
FredFish PD 309.adf
/
SKsh
/
Diffs.doc
< prev
next >
Wrap
Text File
|
1990-01-21
|
7KB
|
265 lines
SKsh/ksh Differences
SKSH
A ksh-like Shell for the Amiga
Version 1.3
(Copyright) 1989, 1990
Steve Koren
January 2, 1990
Introduction
This document describes some of the differences between SKsh
and ksh under Unix. It does not even begin to cover them all.
If you need to have specific information, compare the
appropriate sections of the two manuals.
In general, scripts may be written which run under either SKsh
or ksh by testing the $SHELL parameter:
if [ "$SHELL" = 'sksh' ]
then
echo 'do some SKsh/AmigaDos specific things here'
elif [ "$SHELL" = '/bin/ksh' ]
then
echo 'do some ksh/UNIX specific things here'
fi
Differences List
Alias and Function Resolution
SKsh resolves alias and function names when they are
logically encountered. ksh resolves them when they are
physically encountered. This leads to different behaviours
in functions. For example, in SKsh, you can define a
function that uses an alias that you define after the
function. As long as the alias is defined before the
function is executed (but not necessarily before it is
defined), SKsh will execute the alias normally. In ksh, on
the other hand, the alias must be defined as such when the
function is defined, not when it is executed.
Assignment Syntax
SKsh permits spaces to surround the '=' in an assignment
statement. ksh does not.
${var:val} Operations
ksh has a bunch of variable binding operators that look
like the above, and permit tests and assignments to be made
in one step. SKsh does not support any of these.
SKSH Amiga Shell Page 2 Ash/ksh Differences
vi mode
ksh has a command line editing mode that is similar to vi
bindings. SKsh has only the emacs bindings. I may, in the
future, permit user defined bindings, but this is not high
on my priority list of things to do.
In addition, SKsh emacs command line editing, although
quite useful, is limited compared to that of ksh. SKsh
does not permit cut and paste between lines, etc. A few of
the commands also work differently (such as the ^r search
command).
In-line parameter assignment
ksh permits variables to be assigned to while being used as
a parameter. For example,
export COLUMNS=80
SKsh does not permit this. You must perform the assignment
and export separately.
Job Control
ksh has job control. SKsh does not.
Path Separator Character
ksh uses ':' as a path separator character. Since the
colon is a legal character in AmigaDos path names, a comma
is used instead.
Function Definition Syntax
The SKsh function definition syntax using the 'function'
keyword is compatible with ksh, but ksh also permits an
alternate syntax using 'function() { }' that SKsh does not.
Set vs. Options
ksh uses the 'set' keyword to set options to the shell
itself. SKsh uses 'set' to list alias, variables, and
functions. SKsh uses the 'option' command to set shell
options. These options are, with only a few exceptions,
different from their ksh counterparts.
SKSH Amiga Shell Page 3 Ash/ksh Differences
Scoping Rules
The SKsh scoping rules are different than the scoping rules
in in ksh. Ksh supports the 'typeset' keyword to create
local variables; SKsh controls this with an option flag and
the 'local' command. In addition, SKsh local variables can
be turned off entirely to emulate the sh scoping rules.
Builtin Commands
SKsh accomplishes many things with builtin commands that
ksh accomplishes with external binaries. In addition, Unix
has boatloads more of these commands than the Amiga and
SKsh combined do or ever will. If its on Unix, and not on
AmigaDos, you'll probably have to write it if you want it.
In addition, many of the SKsh commands accept different
parameters than either Unix counterparts with the same
name. Some of them also act differently; for example,
'read' in Unix reads a single parameter separated by IFS,
while 'read' in SKsh reads a whole line.
case...esac statement
ksh supports a case...esac statement that SKsh does not. I
can add this fairly easily, but I haven't done it yet since
1) it would make SKsh even larger, and 2) it can be
simulated by using if...elif...else...fi statements.
until...do...done statement
SKsh does not support this either. I was also not in a
big hurry to add it, since it is simply a while..do..done
statement with the test automatically inverted.
Parameter Breaks
SKsh breaks parameters in different places than ksh. For
example, 'foo'$foo is one parameter in ksh, but two in
SKsh. To make it one in SKsh, use double quotes around the
whole expression: "foo$foo", or use $(concat "foo" "$foo").
Standard Error Redirection
Under AmigaDos, there is no distinction between standard
output and standard error. Thus, you cannot redirect them
independently in SKsh.
SKSH Amiga Shell Page 4 Ash/ksh Differences